home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / isccc / base64.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  2.2 KB  |  73 lines

  1. /*
  2.  * Portions Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
  3.  * Portions Copyright (C) 2001  Internet Software Consortium.
  4.  * Portions Copyright (C) 2001  Nominum, Inc.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software for any
  7.  * purpose with or without fee is hereby granted, provided that the above
  8.  * copyright notice and this permission notice appear in all copies.
  9.  *
  10.  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
  11.  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
  12.  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
  13.  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15.  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17.  */
  18.  
  19. /* $Id: base64.h,v 1.3.18.2 2005/04/29 00:17:13 marka Exp $ */
  20.  
  21. #ifndef ISCCC_BASE64_H
  22. #define ISCCC_BASE64_H 1
  23.  
  24. /*! \file */
  25.  
  26. #include <isc/lang.h>
  27. #include <isccc/types.h>
  28.  
  29. ISC_LANG_BEGINDECLS
  30.  
  31. /***
  32.  *** Functions
  33.  ***/
  34.  
  35. isc_result_t
  36. isccc_base64_encode(isccc_region_t *source, int wordlength,
  37.           const char *wordbreak, isccc_region_t *target);
  38. /*%<
  39.  * Convert data into base64 encoded text.
  40.  *
  41.  * Notes:
  42.  *\li    The base64 encoded text in 'target' will be divided into
  43.  *    words of at most 'wordlength' characters, separated by
  44.  *     the 'wordbreak' string.  No parentheses will surround
  45.  *    the text.
  46.  *
  47.  * Requires:
  48.  *\li    'source' is a region containing binary data.
  49.  *\li    'target' is a text region containing available space.
  50.  *\li    'wordbreak' points to a null-terminated string of
  51.  *        zero or more whitespace characters.
  52.  */
  53.  
  54. isc_result_t
  55. isccc_base64_decode(const char *cstr, isccc_region_t *target);
  56. /*%<
  57.  * Decode a null-terminated base64 string.
  58.  *
  59.  * Requires:
  60.  *\li    'cstr' is non-null.
  61.  *\li    'target' is a valid region.
  62.  *
  63.  * Returns:
  64.  *\li    #ISC_R_SUCCESS    -- the entire decoded representation of 'cstring'
  65.  *               fit in 'target'.
  66.  *\li    #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding.
  67.  *\li    #ISC_R_NOSPACE    -- 'target' is not big enough.
  68.  */
  69.  
  70. ISC_LANG_ENDDECLS
  71.  
  72. #endif /* ISCCC_BASE64_H */
  73.